#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include<QDebug>
#include<QPushButton>
#include<QMouseEvent>
#include<QPoint>
#include<QNetworkAccessManager>
#include<QNetworkReply>
#include<QMessageBox>
#include<QPainter>
#include<QPen>
#include"weatehrdate.h"
#include"weatherTool.h"

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
protected:
    void mousePressEvent(QMouseEvent*event);
    void mouseMoveEvent(QMouseEvent*event);

    void getWeatherInfo(QString cityCode);
    void parseJson(QByteArray&mByteArray);
    void updateUi();

    //重写父类的eventfilter方法
    bool eventFilter(QObject*watched,QEvent*event);

    void pointHighCurve();
    void pointLowCurve();


private slots:
    void onReplied(QNetworkReply*mReply);

    void on_btnSearch_clicked();

private:
    Ui::MainWindow *ui;

    QPoint mOffset;     //窗口移动，鼠标与窗口左上角的偏移
    QNetworkAccessManager*mNetworkAccessManager;
    //weatherdate  class
    todayWeather mTodayWeather;
    weekWeather mWeekWeather[6];


    QList<QLabel*>mWeekList;    //日期
    QList<QLabel*>mDateList;    //日期
    QList<QLabel*>mIconList;    //天气图片
    QList<QLabel*>mTypeList;    //天气类型
    QList<QLabel*>mAqiList;     //污染指数
    QList<QLabel*>mFxList;      //风向
    QList<QLabel*>mFlList;      //风力

    QMap<QString,QString>mTypeMap;


};
#endif // MAINWINDOW_H













